package com.itheima.trade.mapper;

import com.itheima.model.common.dtos.AccountDto;
import com.itheima.model.common.pojos.Account;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

@Mapper
public interface AccountMapper {

    @Select("select * from account where aid=#{aid} and cardno=#{cardno}")
    Account getAccount(Integer aid, String cardno);

    @Select("select * from account where cardno=#{cardno}")
    Account getAccount1(String cardno);

    @Update("update account set remaining = #{subtract} where cardno=#{cardno}")
    void updateAccount(String cardno, BigDecimal subtract);
}
